/*
文件编码:UTF8
题目:HDOJ1248
类别：完全背包
编写人：wei
编写时间：2016-5-19
*/

#include<iostream>
#include<cstring>

using namespace std;

int props[3]={150,200,350};
int n,t;
int max_val[10001];

int main(void)
{
	cin >> t;
	for (int q = 0; q < t; ++q)
	{
		/* code */
		cin >> n;
		memset(max_val,0,sizeof(int)*10001);
		for (int j = 0; j < 3; ++j)
		{
			for (int k = props[j]; k <= n; ++k)
			{
				/* code */
				if(max_val[k] > max_val[k-props[j]]+props[j])
					max_val[k]=max_val[k];
				else
					max_val[k]=max_val[k-props[j]]+props[j];
			}
		}
		cout << n-max_val[n]<<endl;
	}

	return 0;
}